package org.fioma.tree.suffixTree.memory;

import org.fioma.tree.bytes.LabelRefBytesIndex;
import org.fioma.tree.suffixTree.SuffixRoot;

public abstract class SimpleSuffixRootMemory<I extends InternalSuffixNodeMemory<I, F, N>, F extends LeafSuffixNodeMemory<I, F, N>, N extends SuffixNodeMemory<I, F, N>>
		extends SimpleInternalSuffixNodeMemory<I, F, N> implements SuffixRoot<LabelRefBytesIndex, I, F, N> {

	public SimpleSuffixRootMemory(long pos, SuffixTreeHandlerMemory<I, F, N> treeHandler) {
		super(pos, treeHandler);
	}

	@Override
	public I getParent() {
		return null;
	}

	@Override
	public void setParent(I parent) {
		throw new RuntimeException("Parent is invalid in a root");
	}

	@Override
	public boolean isRoot() {
		return true;
	}

	@Override
	public LabelRefBytesIndex getLabel() {
		return null;
	}

	@Override
	public void setLabel(LabelRefBytesIndex label) {
		throw new RuntimeException("Label is invalid in a root");
	}

}
